<?php

/**
 * @link http://www.yincart.com/
 * @copyright Copyright (c) 2014 Yincart
 * @license http://www.yincart.com/license/
 */
use yii\helpers\Html;

$admin = Yii::$app->user->identity;
$menu=$admin->getMenu();

$list=[];
empty($key) && $key='goodsManage';

if(isset($menu[$key])){
    $list=$menu[$key];
}

//print_r($list);
//die();
?>

<style type="text/css" media="all">
    body{background:#F4F4F4;border-right:#E5E5E5 1px solid;margin-top:-20px;padding-top:20px;}
    .itemlist{width:200px;margin-top: 20px;}
    .itemlist li{height:31px;line-height: 31px;padding-left: 12px;}
    .itemlist li.cur a{color:#0080FF;font-weight: bold;font-size: 16px;}
    .itemlist li a{display: block;color:#555555;}
    .itemlist li a:hover{color:#111111;}
</style>

<div class="itemlist">
    <ul>
        <?php foreach ($list['sub'] as $item): ?>
            <li>
                <?php
                $isSet = isset($item['sub']);
                if ($isSet) {
                    echo $item['name'];
                } else {
                    echo Html::a($item['name'], $item['url'], ['target' => 'mainFrame','onFocus'=>'this.blur();']);
                }
                ?>
                <?php if ($isSet): ?>
                    <ul class="subMenu">
                        <?php foreach ($item['sub'] as $item2): ?>
                            <li>
                                <?php echo Html::a($item2['name'], $item2['url'], ['target' => 'mainFrame','onFocus'=>'this.blur();']) ?>
                            </li>
                        <?php endforeach; ?>
                    </ul>
                <?php endif; ?>
            </li>
        <?php endforeach; ?>
        <ul>
</div>